﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="List.aspx.cs" Inherits="MVCClubSite.Web.Views.Announcements.List" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentblock">
        <h2>
            Recent News</h2>
        <%if (User.IsInRole("Administrator"))
          { %>
        <%= Html.ActionLink("Create New", "New" ) %>
        <br />
        <br />
        <% } %>
<% foreach (Announcement a in ViewData.Model.Announcements)
           { %>
        <h3>
            <%= Html.ActionLink(a.Title, "Details", "Announcements", new{ id = a.ID }, null ) %></h3>
        <p>
                <% if (a.Description.Length > 400)
                   { %>
                <%= a.Description.Substring(0, 400) + "..."%>
                <%}
                   else
                   {%>
                <%= a.Description%>
                <% } %>
        </p>
        <h6>
            <%= Html.ActionLink("View article", "Details", "Announcements", new{ id = a.ID}, null ) %></h6>
        <%} %>
        <div class="pager">
            <%= Html.Pager(ViewData.Model.Announcements.PageSize, ViewData.Model.Announcements.PageNumber, ViewData.Model.Announcements.TotalItemCount)%>
        </div>
    </div>
</asp:Content>
